package com.innerchic.mapper.app.base;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.innerchic.mapper.app.SuperFragment;

import java.util.List;

/**
 * ================================================
 * 作    者：贾恒飞 >>> 17515250730@163.com
 * 项    目：young
 * 日    期：2021/11/1 17:52
 * 包    名：com.innerchic.mapper.app.base
 * 描    述：ViewPage Fragment 适配器
 * Create by zFox from AndroidStudio4.2
 * ================================================
 */
public class FragmentAdapter extends FragmentPagerAdapter {
    private List<SuperFragment> list = null;

    public FragmentAdapter(FragmentManager fm) {
        super(fm, BEHAVIOR_SET_USER_VISIBLE_HINT);
    }

    public FragmentAdapter(FragmentManager fm, List<SuperFragment> list) {
        super(fm, BEHAVIOR_SET_USER_VISIBLE_HINT);
        this.list = list;
    }

    @NonNull
    @Override
    public SuperFragment getItem(int postion) {
        return list.get(postion);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return list.get(position).getTitle();
    }

    @Override
    public int getCount() {
        return list.size();
    }

}
